package com.zsl.swing.redis.desktop.window.dialog;

import com.zsl.swing.redis.desktop.common.IconPaths;
import com.zsl.swing.redis.desktop.common.StaticFields;
import com.zsl.swing.redis.desktop.type.MainMenuEnum;
import com.zsl.swing.redis.desktop.utils.CommonUtils;
import com.zsl.swing.redis.desktop.utils.IconUtils;
import com.zsl.swing.redis.desktop.window.ZslRedisDesktopMainWindow;
import com.zsl.swing.redis.desktop.window.panel.ZslImgPanel;

import javax.swing.*;
import java.awt.*;

public class ZslCollectionDialog extends JDialog {

    private static final Image C_ICON = IconUtils.getScaleImage(IconPaths.REWARD_ICON,30,30);


    public ZslCollectionDialog(){
        super(ZslRedisDesktopMainWindow.getMainWindow());

        this.setTitle(MainMenuEnum.REWARD.getText());
        this.setIconImage(C_ICON);

        int width = ZslRedisDesktopMainWindow.getMainWindow().getWidth() / 3;
        int height = ZslRedisDesktopMainWindow.getMainWindow().getHeight() * 5 / 6;
        this.setSize(width, height);

        int x = CommonUtils.maxWidth()/2 - width /2;
        int y = CommonUtils.maxHeight()/2 - height /2;
        this.setLocation(x, y);

        ZslImgPanel zslImgPanel = ZslImgPanel.getInstance(StaticFields.IPM_PATH, this);
        this.setContentPane(zslImgPanel);

        this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        this.setVisible(true);
    }

    public static void showDialog(){
        new ZslCollectionDialog();
    }
}
